package com.saas.after.job.entity;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.saas.after.job.config.Comment;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;

/**
 * @Classname CustomerEntity
 * @Description TODO
 * @Date 5021/8/16 15:03
 * @Created by hjchen
 */

@Data
@Entity
@Table(name = "t_customer")
@Comment("客户基础信息")
@EqualsAndHashCode(callSuper = true)
public class CustomerEntity extends BaseEntity {

    @Column(length = 50)
    @Comment("客户名称")
    private String name;

    @Column(length = 50)
    @Comment("客户主数据编码")
    private String custCode;

    @Comment("客户中台编码")
    @Column(length = 50)
    private String ztCode;

    @Comment("上级客户主数据编码")
    @Column(length = 50)
    private String parentCustCode;

    @Comment("上级客户中台编码")
    @Column(length = 50)
    private String parentZtCode;

    @Comment("上级客户名称")
    @Column(length = 50)
    private String parentZtName;

    @Comment("贸易伙伴编码")
    @Column(length = 50)
    private String tradePartnerCode;

    @Comment("贸易伙伴名称")
    @Column(length = 50)
    private String tradePartnerName;

    @Column
    @Comment("分析属性")
    private String analysisProp;

    @Column
    @Comment("合作伙伴类型(1 个体户零售商、2 连锁零售商、3 合伙运营商、4分销代理商、5代⼯客户、6服务结算客户、7 品牌代理商)")
    private String partnerType;

    @Transient
    private List<String> partnerTypeList;

    @Column
    @Comment("经营⽅式(1 经销、2 委托代销)")
    private Integer managementMode;

    @Comment("联系信息")
    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "contact_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    private ContactInfo contactInfo;

    @Comment("收货信息")
    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "receive_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    private ContactInfo receiverInfo;

}